//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Data Access Application Block
//===============================================================================

using System;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel;
using Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation;


namespace Microsoft.Practices.EnterpriseLibrary.Data.MySql
{
	/// <summary>
	/// Represents the process to build an instance of <see cref="MySqlDatabase"/>
	/// described by configuration information.
	/// </summary>
	/// <remarks>
	/// Revision 1: Steve Phillips  Date: 23 May 2009 - Updated to use EntLib 4.1 core
	/// </remarks>
	/// <author>Wesley Hobbie</author>
	/// <version>4.1</version>
	/// <date>05/23/2009</date>
    public class MySqlDatabaseData : DatabaseData
	{
       
        #region Public Methods
        public MySqlDatabaseData(ConnectionStringSettings connectionStringSettings, IConfigurationSource configurationSource)
            : base(connectionStringSettings, configurationSource)
        {
        }
		#endregion

        public override System.Collections.Generic.IEnumerable<Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeRegistration> GetRegistrations()
        {
            yield return new TypeRegistration<Database>(
                () => new MySqlDatabase(
                    ConnectionString,
                    Container.Resolved<IDataInstrumentationProvider>(Name))) {
                        Name = Name,
                        Lifetime = TypeRegistrationLifetime.Transient
                    };
        }
    }
}
